{% extends "base.html" %}

{% block title %}Archive Files - Archive Audit System{% endblock %}

{% block content %}
<h2>Archive Unstructured Data</h2>
<div class="card">
    <div class="card-header">
        <h5>Upload Files</h5>
    </div>
    <div class="card-body">
        <form method="post" enctype="multipart/form-data">
            <div class="mb-3">
                <label for="files" class="form-label">Select Files</label>
                <input type="file" class="form-control" id="files" name="files[]" multiple required>
                <div class="form-text">Select one or more files to archive. You can select multiple files at once.</div>
            </div>
            <div class="mb-3">
                <label for="description" class="form-label">Description</label>
                <textarea class="form-control" id="description" name="description" rows="3" required></textarea>
                <div class="form-text">Provide a detailed description of this file archive.</div>
            </div>
            <button type="submit" class="btn btn-primary">Archive Files</button>
        </form>
    </div>
</div>

<div class="card mt-4">
    <div class="card-header">
        <h5>About File Archiving</h5>
    </div>
    <div class="card-body">
        <p>When you archive files:</p>
        <ul>
            <li>All selected files are copied to the archive</li>
            <li>File metadata (size, type, etc.) is extracted</li>
            <li>SHA-256 hashes are calculated for integrity verification</li>
            <li>The archive is indexed for future searching</li>
            <li>Directory structure is preserved if multiple files are selected</li>
        </ul>
        <p>All file types are supported.</p>
    </div>
</div>
{% endblock %}

{% block extra_js %}
<script>
document.addEventListener('DOMContentLoaded', function() {
    // Show selected file count
    document.getElementById('files').addEventListener('change', function(e) {
        const fileCount = e.target.files.length;
        const fileText = document.querySelector('.form-text');
        fileText.textContent = `${fileCount} file(s) selected for archiving.`;
    });
});
</script>
{% endblock %}
